import eslintConfig from '@electron-toolkit/eslint-config';
import eslintConfigPrettier from '@electron-toolkit/eslint-config-prettier';
import eslintPluginVue from 'eslint-plugin-vue';
import yaml from 'js-yaml';
import * as fs from 'node:fs'; // 用于解析 YAML 文件

// 读取 .prettierrc.yaml 文件
const prettierConfig = yaml.load(fs.readFileSync('.prettierrc.yaml', 'utf8'));

export default [
  { ignores: ['**/node_modules', '**/dist', '**/out'] },
  eslintConfig,
  ...eslintPluginVue.configs['flat/recommended'],
  {
    files: ['**/*.{js,jsx,vue}'],
    rules: {
      'vue/require-default-prop': 'off',
      'vue/multi-word-component-names': 'off',
      'prettier/prettier': [
        'warn',
        {
          ...prettierConfig, // 直接展开 .prettierrc.yaml 中的配置
        },
      ],
    },
  },
  eslintConfigPrettier,
];
